#include <unordered_map>
#include <iostream>

class NameMap : protected std::unordered_map<std::string, u64> {
typedef std::unordered_map<std::string, u64> BaseClass;

public:
  static const u64 notFound = -1;
  
  NameMap(std::initializer_list<value_type> il) : BaseClass(il) {};
  
  u64 operator()(const std::string &s) {
    auto it = find(s);
    return it == end() ? notFound : it->second;
  }
};

NameMap flagsMap = {
  { "P",      PF_PRESENT      },
  { "W",      PF_WRITE        },
  { "U",      PF_USER         },
  { "PWT",    PF_PWT          },
  { "PCD",    PF_PCD          },
  { "A",      PF_ACCESSED     },
  { "D",      PF_DIRTY        },
  { "PS",     PF_MAP_PAGE     },
  { "PAT7",   PF_PAT_PTE      },
  { "G",      PF_GLOBAL       },
  { "PAT12",  PF_PAT12        },
  { "XD",     PF_UNEXECUTABLE },
  { "R",      PF_RCVD         },
  { "I",      PF_INSTRUCTION  }
};